import { _decorator, Component, Node, UIOpacity, tween } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('BloodEffect')
export class BloodEffect extends Component {

    static Instance: BloodEffect = null;

    opacity: UIOpacity = null!;

    onLoad() {
        BloodEffect.Instance = this;
        this.opacity = this.node.getComponent(UIOpacity);
        this.node.active = false;
    }

    Show() {
        this.node.active = true;
        this.opacity.opacity = 255;
        tween(this.opacity).to(1, { opacity: 0 }).call(() => {
            this.node.active = false;
        }).start();
    }

}